package com.d0316;

public class Employee {
    private String name;
    private int salary;

    public Employee() {
    }

    public Employee(String name, int salary) {
        this.name = name;
        this.salary = salary;
    }

    public void setSalary(int salary) throws DateValueException {
        if (salary<2000){
            throw new DateValueException("不能低于2000");
        }
        this.salary = salary;
    }

    public static void main(String[] args) {
        Employee employee=new Employee();
        try {
            employee.setSalary(10000);
        } catch (DateValueException e) {
            e.printStackTrace();
            System.out.println("不能低于1000");
        }
        System.out.println(employee.salary);
    }
}
